package com.welsy.authoring.business
{
	import mx.rpc.Fault;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.soap.mxml.WebService;	
	import mx.rpc.AbstractOperation;
	import com.adobe.cairngorm.business.ServiceLocator;
	import mx.rpc.IResponder;
	import mx.rpc.AsyncToken;
	import flash.utils.setTimeout;	
	import mx.collections.XMLListCollection;
		

	/**
	  * Utility class for itinera managing
	  * @author Welsy.org
	  * @version	$Revision: 1.1 $
	  */
	public class hasIteraDelegate
	{
		/**
		  * Delegate set up for itinera presence checking in courses
		  * @param responder The responder for the server SOAP reply
		  */
		public function hasIteraDelegate( responder : IResponder )
		{		
			this.service = ServiceLocator.getInstance().getWebService("CourseService") as WebService;
			var o:AbstractOperation = service.getOperation("SetEditingStateCourse");
			this.responder = responder;
		}
										
		/**
		  * Requests the editing state for a given course
		  * @param id The course ID
		  */
		public function hasItera(id:String) : void
		{					
			var o:AbstractOperation = service.getOperation("SetEditingStateCourse");
			o.arguments.SetEditingStateCourseRequest.CourseID = id;
			
			var token:AsyncToken = service.SetEditingStateCourse();
			// request for this command to be notified when the service call completes
			token.addResponder( responder );
		}	
		
		private var responder : IResponder;
		private var service : Object;
	}

}